<template>
  <div>
    <card
      :title="title"
      :headstyle="cardstyle"
      :class="initAnchorInfo"
      shadow="nerver"
    >
      <PublicTable
        ref="table1"
        :loading="false"
        :table-data="info"
        :columns="columns"
        :options="options"
      />
      <div class="zy_title">船舶动态</div>
      <PublicTable
        ref="table1"
        :loading="false"
        :table-data="shipinfo"
        :columns="shipcolumns"
        :options="options"
      />
      <div class="zy_title">作业情况</div>
      <PublicTable
        ref="table1"
        :loading="false"
        :table-data="zyinfo"
        :columns="zycolumns"
        :options="options"
      />
      <div class="zy_title">停工情况</div>
      <PublicTable
        ref="table1"
        :loading="false"
        :table-data="tginfo"
        :columns="tgcolumns"
        :options="options"
      />
    </card>
  </div>
</template>

<script>
const columns = [
  {
    label: "抵锚时间",
    prop: "ATANCHORTIME",
    minwidth: "140",
  },
  {
    label: "靠泊时间",
    prop: "BERTHTIME",
    minwidth: "140",
  },
  {
    label: "开工时间",
    prop: "STARTTIME",
    minwidth: "140",
  },
  {
    label: "完工时间",
    prop: "ENDTIME",
    minwidth: "140",
  },
  {
    label: "离泊时间",
    prop: "LEAVETIME",
    minwidth: "140",
  },
  {
    label: "在港时长",
    prop: "DELAY",
    minwidth: "90",
  },
  {
    label: "作业时长",
    prop: "ZYDELAY",
    minwidth: "90",
  },
  {
    label: "水尺吨",
    prop: "DRAFT",
    minwidth: "90",
  },
  {
    label: "效率",
    prop: "XL",
    minwidth: "90",
  },
  {
    label: "误差",
    prop: "DB",
    minwidth: "90",
  }
];
const zycolumns = [
  {
    label: "事项",
    prop: "DYNAMICCODE",
    optionsdic: "sys_workx_py",
    minwidth: "90",
  },
  {
    label: "开始时间",
    prop: "STARTTIME",
    minwidth: "140",
  },
  {
    label: "结束时间",
    prop: "ENDTIME",
    minwidth: "140",
  },
  {
    label: "时长",
    prop: "DELAY",
    minwidth: "90",
  },
  {
    label: "流程号",
    prop: "FLOWID",
    minwidth: "90",
  },
  {
    label: "皮带秤吨",
    prop: "DC3TON",
    minwidth: "90",
  },
  {
    label: "负荷开始",
    prop: "FHSTARTTIME",
    minwidth: "140",
  },
  {
    label: "负荷结束",
    prop: "FHENDTIME",
    minwidth: "140",
  },
  {
    label: "负荷时长",
    prop: "FHDELAY",
    minwidth: "90",
  },
  {
    label: "UL1",
    optionsdic: "sys_sf",
    prop: "XCJ",
    minwidth: "90",
  },
  {
    label: "UL2",
    optionsdic: "sys_sf",
    prop: "XCJ2",
    minwidth: "90",
  },
  {
    label: "UL3",
    optionsdic: "sys_sf",
    prop: "XCJ3",
    minwidth: "90",
  },
  {
    label: "UL4",
    optionsdic: "sys_sf",
    prop: "XCJ4",
    minwidth: "90",
  },
  {
    label: "影响因素",
    prop: "YXYS",
    optionsdic: "sys_zxcgzys",
    minwidth: "140",
  },
  {
    label: "说明",
    prop: "NOTE",
    minwidth: "140",
  }
];
const tgcolumns = [
  {
    label: "事项",
    prop: "DYNAMICCODE",
    optionsdic: "sys_workx_py",
    minwidth: "90",
  },
  {
    label: "开始时间",
    prop: "STARTTIME",
    minwidth: "140",
  },
  {
    label: "结束时间",
    prop: "ENDTIME",
    minwidth: "140",
  },
  {
    label: "时长",
    prop: "DELAY",
    minwidth: "90",
  },
  {
    label: "影响因素",
    prop: "YXYS",
    optionsdic: "sys_zxcgzys",
    minwidth: "140",
  },
  {
    label: "说明",
    prop: "NOTE",
    minwidth: "140",
  }
];
const fzcolumns = [
  {
    label: "事项",
    prop: "DYNAMICCODE",
    optionsdic: "sys_workx_py",
    minwidth: "90",
  },
  {
    label: "开始时间",
    prop: "STARTTIME",
    minwidth: "140",
  },
  {
    label: "结束时间",
    prop: "ENDTIME",
    minwidth: "140",
  },
  {
    label: "时长",
    prop: "DELAY",
    minwidth: "90",
  },
  {
    label: "影响因素",
    optionsdic: "sys_zxcgzys",
    prop: "YXYS",
    minwidth: "140",
  },
  {
    label: "说明",
    prop: "NOTE",
    minwidth: "140",
  }
];
const shipcolumns = [
  {
    label: "船舶动态",
    prop: "DYNAMICCODE",
    optionsdic: "sys_phaseproject",
    minwidth: "90",
  },
  {
    label: "开始时间",
    prop: "STARTTIME",
    minwidth: "140",
  },
  {
    label: "结束时间",
    prop: "ENDTIME",
    minwidth: "140",
  },
  {
    label: "时长",
    prop: "DELAY",
    minwidth: "90",
  },
  {
    label: "备注",
    prop: "YXYS",
    minwidth: "200",
  },
  // {
  //   label: "录入人",
  //   prop: "NOTE",
  //   minwidth: "140",
  // },
  // {
  //   label: "录入时间",
  //   prop: "NOTE",
  //   minwidth: "140",
  // }
];
export default {
  name: "ZyInfo",
  props: {
    initAnchorInfo: {
      type: String,
      default: "xxxxxxxx",
    },
    cardstyle: {
      type: Object,
      default() {
        return {}
      },
    },
    title: {
      type: String,
      default() {
        return ""
      },
    },
    shipseq: {
      type: String,
      default() {
        return ""
      },
    },
  },
  data() {
    return {
      cardzbstyle: {
        backgroundColor: "#fff",
      },
      info: [],
      zyinfo: [],
      tginfo: [],
      fzinfo: [],
      shipinfo: [],
      columns,
      zycolumns,
      tgcolumns,
      fzcolumns,
      shipcolumns,
      options: {},
    }
  },
  computed: {
    infoform() {
      return this.info[0] || {}
    }
  },
  mounted() {
    this.init()
  },
  methods: {
    init() {
      this.queryinfo()
    },
    // 查询船舶基本信息
    queryinfo() {
      this.$api.summary.JK_SHIP_WORK({ shipseq: this.shipseq }).then((val) => {
        this.info = val.zmap
        this.zyinfo = val.zyqk
        this.tginfo = val.tgqk
        this.shipinfo = val.cbdt
      })
    },
  }
}
</script>

<style lang="scss" scoped>
.zy_title{
  text-align: center;
  font-size: 17px;
}
</style>
